package com.anjubao.parking.municipal.payment.controller;


import com.anjubao.parking.municipal.payment.service.WeiXinNotifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 支付回调
 *
 * @author zhuchunfeng
 */
@RestController
@RequestMapping("/parking-payment-notify")
@Slf4j
@Api(value = "车场支付订单相关接口",tags = {"支付回调"})
public class ParkingTradeNotifyController {

    @Resource
    private WeiXinNotifyService weiXinNotifyService;

    /**
     * 微信支付回调
     * @return success 成功 fail 失败
     */
    @PostMapping("/wx/notify")
    @ApiOperation("微信支付回调处理")
    public String wxPayNotify(@RequestBody String xmlData) {
        log.info("收到微信支付回调 xmlData {}",xmlData);
        return weiXinNotifyService.parseOrderNotifyResult(xmlData);
    }

}
